<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:isc="http://extension-functions.intersystems.com" xmlns:hl7="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:exsl="http://exslt.org/common" exclude-result-prefixes="isc hl7 xsi exsl">
    <!--注意，并不是所有HCC文档都有Encounter(encompassingEncounter)-->
	<xsl:template match="*" mode="Encounters">
		<xsl:choose>
			<!-- Encounter in 卫生事件章节 -->
			<xsl:when test="$hccDocType='C0001'">
				<xsl:apply-templates select="$sectionRootPath[hl7:code/@displayName=$hcc_HealthcareEvent]" mode="EventEncounter"/>
			</xsl:when>
			<!-- Encounter in providerOrganization with less or more details -->
			<xsl:when test="($hccDocType='C0002') or ($hccDocType='C0003') or ($hccDocType='C0004') or ($hccDocType='C0005') or ($hccDocType='C0024') or ($hccDocType='C0025')">
				<xsl:apply-templates select="." mode="OtherEncounter"/>
			</xsl:when>
			<!-- Encounter in encompassingEncounter -->	
			<xsl:otherwise>
				<xsl:apply-templates select="hl7:componentOf/hl7:encompassingEncounter" mode="DefaultEncounter"/>
			</xsl:otherwise>		
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
